Cox Model Performance
Here we evaluate the model using the RRPlot() function.
The evaluation of the raw Cox model with RRPlot()
Here we will use the predicted event probability assuming a baseline
hazard for events withing 5 years
timeinterval <- mean(subset(dataFLTrain,status==1)$time)
h0 <- sum(dataFLTrain$status & dataFLTrain$time <= timeinterval)
h0 <- h0/sum((dataFLTrain$time > timeinterval) | (dataFLTrain$status==1))
pander::pander(t(c(h0=h0,timeinterval=timeinterval)),caption="Initial Parameters")
Initial Parameters
| 0.161 |
5.73 |
index <- predict(ml,dataFLTrain)
rdata <- cbind(dataFLTrain$status,ppoisGzero(index,h0))
rrAnalysisTrain <- RRPlot(rdata,atRate=c(0.90,0.80),
timetoEvent=dataFLTrain$time,
title="Raw Train: FLC",
ysurvlim=c(0.00,1.0),
riskTimeInterval=timeinterval)






As we can see the Observed probability as well as the Time vs. Events
are not calibrated.
Uncalibrated Performance Report
pander::pander(t(rrAnalysisTrain$OERatio),caption="O/E Ratio")
Quitting from lines 105-118 [unnamed-chunk-5] (flchain.Rmd) Error in
[.data.frame: ! undefined columns selected Backtrace: 1.
pander::pander(t(rrAnalysisTrain\(OERatio),
caption = "O/E Ratio") 2.
pander:::pander.htest(t(rrAnalysisTrain\)OERatio), caption = “O/E
Ratio”) 3. pander::pandoc.table(res, caption = caption, …) 5.
pander::pandoc.table.return(…) 7. base::sapply(1:ncol(t), function(x)
is.numeric(t[, x])) 8. base::lapply(X = X, FUN = FUN, …) 9. pander
(local) FUN(X[[i]], …) 11. base::[.data.frame(t, , x)
Warning messages: 1: In doTryCatch(return(expr), name, parentenv,
handler) : “quiet” is not a graphical parameter 2: In
doTryCatch(return(expr), name, parentenv, handler) : “quiet” is not a
graphical parameter 3: In doTryCatch(return(expr), name, parentenv,
handler) : “quiet” is not a graphical parameter 4: In
doTryCatch(return(expr), name, parentenv, handler) : “quiet” is not a
graphical parameter 5: In doTryCatch(return(expr), name, parentenv,
handler) : “quiet” is not a graphical parameter 6: In
doTryCatch(return(expr), name, parentenv, handler) : “quiet” is not a
graphical parameter 7: In doTryCatch(return(expr), name, parentenv,
handler) : “quiet” is not a graphical parameter 8: In
doTryCatch(return(expr), name, parentenv, handler) : “quiet” is not a
graphical parameter 9: In doTryCatch(return(expr), name, parentenv,
handler) : “quiet” is not a graphical parameter
pander::pander(t(rrAnalysisTrain$OE95ci),caption="O/E Ratio")
O/E Ratio
| 0.679 |
0.678 |
0.674 |
0.683 |
pander::pander(t(rrAnalysisTrain$OAcum95ci),caption="O/Acum Ratio")
O/Acum Ratio
| 1.13 |
1.13 |
1.13 |
1.13 |
pander::pander(t(rrAnalysisTrain$c.index$cstatCI),caption="C. Index")
C. Index
| 0.777 |
0.777 |
0.758 |
0.795 |
#pander::pander(rrAnalysisTrain$c.index,caption="C. Index")
pander::pander(t(rrAnalysisTrain$ROCAnalysis$aucs),caption="ROC AUC")
ROC AUC
| 0.824 |
0.804 |
0.845 |
pander::pander((rrAnalysisTrain$ROCAnalysis$sensitivity),caption="Sensitivity")
Sensitivity
| 0.562 |
0.521 |
0.602 |
pander::pander((rrAnalysisTrain$ROCAnalysis$specificity),caption="Specificity")
Specificity
| 0.899 |
0.882 |
0.914 |
pander::pander(t(rrAnalysisTrain$thr_atP),caption="Probability Thresholds")
Probability Thresholds
| 0.302 |
0.215 |
pander::pander(t(rrAnalysisTrain$RR_atP),caption="Risk Ratio")
Quitting from lines 105-118 [unnamed-chunk-5] (flchain.Rmd) Error in
t.default(): ! argument is not a matrix Backtrace: 1.
pander::pander(t(rrAnalysisTrain\(RR_atP),
caption = "Risk Ratio") 3.
base::t.default(rrAnalysisTrain\)RR_atP)
pander::pander(rrAnalysisTrain$surdif,caption="Logrank test")
Logrank test Chisq = 694.989012 on 2 degrees of freedom, p =
0.000000
| class=0 |
1305 |
189 |
436.0 |
139.89 |
505.22 |
| class=1 |
214 |
76 |
65.9 |
1.54 |
1.73 |
| class=2 |
481 |
340 |
103.1 |
544.04 |
664.87 |
Cox Calibration
op <- par(no.readonly = TRUE)
calprob <- CoxRiskCalibration(ml,dataFLTrain,"status","time")
( 13.74924 , 9120.585 , 1.200408 , 604 , 648.2787 )
pander::pander(c(h0=calprob$h0,
Gain=calprob$hazardGain,
DeltaTime=calprob$timeInterval),
caption="Cox Calibration Parameters")
Calibrated Train Performance
pander::pander(t(rrAnalysisTrain$OERatio),caption="O/E Ratio")
Quitting from lines 156-169 [unnamed-chunk-8] (flchain.Rmd) Error in
[.data.frame: ! undefined columns selected Backtrace: 1.
pander::pander(t(rrAnalysisTrain\(OERatio),
caption = "O/E Ratio") 2.
pander:::pander.htest(t(rrAnalysisTrain\)OERatio), caption = “O/E
Ratio”) 3. pander::pandoc.table(res, caption = caption, …) 5.
pander::pandoc.table.return(…) 7. base::sapply(1:ncol(t), function(x)
is.numeric(t[, x])) 8. base::lapply(X = X, FUN = FUN, …) 9. pander
(local) FUN(X[[i]], …) 11. base::[.data.frame(t, , x)
Warning messages: 1: In doTryCatch(return(expr), name, parentenv,
handler) : “quiet” is not a graphical parameter 2: In
doTryCatch(return(expr), name, parentenv, handler) : “quiet” is not a
graphical parameter 3: In doTryCatch(return(expr), name, parentenv,
handler) : “quiet” is not a graphical parameter 4: In
doTryCatch(return(expr), name, parentenv, handler) : “quiet” is not a
graphical parameter 5: In doTryCatch(return(expr), name, parentenv,
handler) : “quiet” is not a graphical parameter 6: In
doTryCatch(return(expr), name, parentenv, handler) : “quiet” is not a
graphical parameter 7: In doTryCatch(return(expr), name, parentenv,
handler) : “quiet” is not a graphical parameter 8: In
doTryCatch(return(expr), name, parentenv, handler) : “quiet” is not a
graphical parameter 9: In doTryCatch(return(expr), name, parentenv,
handler) : “quiet” is not a graphical parameter
pander::pander(t(rrAnalysisTrain$OE95ci),caption="O/E Ratio")
O/E Ratio
| 0.99 |
0.99 |
0.984 |
0.996 |
pander::pander(t(rrAnalysisTrain$OAcum95ci),caption="O/Acum Ratio")
O/Acum Ratio
| 1.07 |
1.07 |
1.07 |
1.07 |
pander::pander(t(rrAnalysisTrain$c.index$cstatCI),caption="C. Index")
C. Index
| 0.777 |
0.777 |
0.758 |
0.796 |
#pander::pander(rrAnalysisTrain$c.index,caption="C. Index")
pander::pander(t(rrAnalysisTrain$ROCAnalysis$aucs),caption="ROC AUC")
ROC AUC
| 0.824 |
0.804 |
0.845 |
pander::pander((rrAnalysisTrain$ROCAnalysis$sensitivity),caption="Sensitivity")
Sensitivity
| 0.562 |
0.521 |
0.602 |
pander::pander((rrAnalysisTrain$ROCAnalysis$specificity),caption="Specificity")
Specificity
| 0.899 |
0.882 |
0.914 |
pander::pander(t(rrAnalysisTrain$thr_atP),caption="Probability Thresholds")
Probability Thresholds
| 0.449 |
0.331 |
pander::pander(t(rrAnalysisTrain$RR_atP),caption="Risk Ratio")
Quitting from lines 156-169 [unnamed-chunk-8] (flchain.Rmd) Error in
t.default(): ! argument is not a matrix Backtrace: 1.
pander::pander(t(rrAnalysisTrain\(RR_atP),
caption = "Risk Ratio") 3.
base::t.default(rrAnalysisTrain\)RR_atP)
pander::pander(rrAnalysisTrain$surdif,caption="Logrank test")
Logrank test Chisq = 694.989012 on 2 degrees of freedom, p =
0.000000
| class=0 |
1305 |
189 |
436.0 |
139.89 |
505.22 |
| class=1 |
214 |
76 |
65.9 |
1.54 |
1.73 |
| class=2 |
481 |
340 |
103.1 |
544.04 |
664.87 |
Performance on the test data set
index <- predict(ml,dataFLTest)
pp <- predictionStats_binary(cbind(dataFLTest$status,index),plotname="FLC")

par(op)
prob <- ppoisGzero(index,h0)
rdata <- cbind(dataFLTest$status,prob)
rrAnalysis <- RRPlot(rdata,atThr=rrAnalysisTrain$thr_atP,
timetoEvent=dataFLTest$time,
title="Test: FLC",
ysurvlim=c(0.00,1.0),
riskTimeInterval=timeinterval)






par(op)
External Data Report
pander::pander(t(rrAnalysis$OERatio),caption="O/E Ratio")
Quitting from lines 196-208 [unnamed-chunk-10] (flchain.Rmd) Error in
[.data.frame: ! undefined columns selected Backtrace: 1.
pander::pander(t(rrAnalysis\(OERatio), caption
= "O/E Ratio") 2.
pander:::pander.htest(t(rrAnalysis\)OERatio), caption = “O/E
Ratio”) 3. pander::pandoc.table(res, caption = caption, …) 5.
pander::pandoc.table.return(…) 7. base::sapply(1:ncol(t), function(x)
is.numeric(t[, x])) 8. base::lapply(X = X, FUN = FUN, …) 9. pander
(local) FUN(X[[i]], …) 11. base::[.data.frame(t, , x) There
were 18 warnings (use warnings() to see them)
pander::pander(t(rrAnalysis$OE95ci),caption="O/E Ratio")
O/E Ratio
| 0.946 |
0.946 |
0.942 |
0.951 |
pander::pander(t(rrAnalysis$OAcum95ci),caption="O/Acum Ratio")
O/Acum Ratio
| 1.05 |
1.05 |
1.05 |
1.05 |
pander::pander(t(rrAnalysis$c.index$cstatCI),caption="C. Index")
C. Index
| 0.797 |
0.797 |
0.785 |
0.809 |
#pander::pander(rrAnalysis$c.index,caption="C. Index")
pander::pander(t(rrAnalysis$ROCAnalysis$aucs),caption="ROC AUC")
ROC AUC
| 0.838 |
0.825 |
0.851 |
pander::pander((rrAnalysis$ROCAnalysis$sensitivity),caption="Sensitivity")
Sensitivity
| 0.587 |
0.561 |
0.614 |
pander::pander((rrAnalysis$ROCAnalysis$specificity),caption="Specificity")
Specificity
| 0.905 |
0.894 |
0.915 |
pander::pander(t(rrAnalysis$thr_atP),caption="Probability Thresholds")
Probability Thresholds
| 0.449 |
0.331 |
pander::pander(t(rrAnalysis$RR_atP),caption="Risk Ratio")
Quitting from lines 196-208 [unnamed-chunk-10] (flchain.Rmd) Error in
t.default(): ! argument is not a matrix Backtrace: 1.
pander::pander(t(rrAnalysis\(RR_atP), caption
= "Risk Ratio") 3.
base::t.default(rrAnalysis\)RR_atP)
pander::pander(rrAnalysis$surdif,caption="Logrank test")
Logrank test Chisq = 1859.709512 on 2 degrees of freedom, p =
0.000000
| class=0 |
2953 |
376 |
992 |
382.6 |
1440 |
| class=1 |
472 |
184 |
138 |
15.3 |
17 |
| class=2 |
1099 |
797 |
227 |
1433.1 |
1746 |